package cn.jbolt.ai.core.chain.node.action.klb;

import cn.jbolt.util.JSONUtil;
import com.fasterxml.jackson.databind.JsonNode;

/**
 * 知识库回答配置
 */
public class KlbChatNodeConfig {

    /**
     * 是否仅知识库
     */
    private boolean onlyKlb = false;


    /**
     * 知识库查询结果 来源字段
     */
    private String klbResultField ;

    /**
     * 输出的字段名
     */
    private String outputField;

    /**
     * 未匹配到知识库的回答
     */
    private String noMatchReply = "";

    /**
     * 是否显示知识库参考
     */
    private boolean showDocRefers = true;

    /**
     * 是否使用html优化显示效果
     */
    private Boolean showWithHtml = null;

    public static KlbChatNodeConfig from(JsonNode jsonNode) {
        return JSONUtil.toObject(jsonNode, KlbChatNodeConfig.class);
    }

    public static JsonNode getDefaultConfig() {
        return JSONUtil.toJsonObject(new KlbChatNodeConfig());
    }


    public boolean isOnlyKlb() {
        return onlyKlb;
    }

    public void setOnlyKlb(boolean onlyKlb) {
        this.onlyKlb = onlyKlb;
    }


    public String getKlbResultField() {
        return klbResultField;
    }

    public void setKlbResultField(String klbResultField) {
        this.klbResultField = klbResultField;
    }

    public String getOutputField() {
        return outputField;
    }

    public void setOutputField(String outputField) {
        this.outputField = outputField;
    }

    public String getNoMatchReply() {
        return noMatchReply;
    }

    public void setNoMatchReply(String noMatchReply) {
        this.noMatchReply = noMatchReply;
    }

    public boolean isShowDocRefers() {
        return showDocRefers;
    }

    public void setShowDocRefers(boolean showDocRefers) {
        this.showDocRefers = showDocRefers;
    }

    public Boolean getShowWithHtml() {
        return showWithHtml;
    }

    public void setShowWithHtml(Boolean showWithHtml) {
        this.showWithHtml = showWithHtml;
    }
}
